import "./App.css";
import {useEffect, useState} from "react";
import {useLocation} from "react-router-dom";
import ConsoleHomePage from "./pages/console/home/consoleHomePage";
import RouteTypeUtils from "./utils/routeTypeUtils";
import PublicHomePage from "./pages/public/home/publicHomePage";

function App() {
    const location = useLocation();
    const [routeType, setRouteType] = useState("");

    useEffect(() => {
        setRouteType(RouteTypeUtils.getRouteType(location.pathname))
    }, [location.pathname]);

    const renderContent = () => {
        switch (routeType) {
            case "public":
                return <PublicHomePage/>;
            case "front":
                return <div/>;
            case "console":
                return <ConsoleHomePage location={location}/>;
            default:
                return <div/>;
        }
    };

    // 添加外层容器，应用app-container样式
    return (
        <div className="app-container">
            {renderContent()}
        </div>
    );
}

export default App;